package stream.part3;

import java.util.Optional;
import java.util.function.BinaryOperator;
import java.util.stream.Stream;

public class Demo03 {
    public static void main(String[] args) {
        Optional<Integer> reduce = Stream.of(1, 2, 3, 4).reduce(Integer::sum);

        System.out.println(reduce.get());
        Integer reduce1 = Stream.of(1, 2, 3, 4).reduce(0, Integer::sum);
        System.out.println(reduce1);
    }
}
